package com.wanczy.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.wanczy.pojo.UserTable;
import com.wanczy.service.UserLoginService;
import com.wanczy.service.impl.UserLoginServiceImpl;

@WebServlet("/servlet/updateQuery")
public class UpdateQuery extends HttpServlet {
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		int userId = Integer.parseInt(request.getParameter("userId"));
		
		UserLoginService service = new UserLoginServiceImpl();
		
		UserTable userTable = service.findById(userId);
		
		request.setAttribute("userTable", userTable);
		
		request.getRequestDispatcher("/jsp/userManager/update.jsp").forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
